1. Field of the Invention
The present invention relates to shifter architectures, and more specifically to a method and apparatus for shifting an operand left or right while minimizing the number of multiplexor stages.
2. Related Art
Shifters are often used to shift operands. A typical shifter receives an operand and a shift value, and generates a desired result by shifting the operand a number of positions determined by the shift value. For example, if a 10 bit operand (with bit positions 1–10) has to be right shifted by a shift value of 3, then bits 1 through 7 of the operand are respectively moved to bit positions 4 to 10. The sign of the operand is placed in bit positions 1–3 in the case of an arithmetic shift operation, and a zero is placed in the bit positions in the case of a logical shift operation.
Log shifters are a type shifters containing a number of stages, with each stage typically containing a multiplexor. Each stage receives a data value and a shifted data value as inputs, and selects one of the two inputs depending on a control bit. An operand to be shifted is a provided as the data value for the first stage, and the output of each stage is provided as a data value to the subsequent stage. The control bits applied to all multiplexors together forms the shift value, and determines the extent of the shift by a log shifter.
Log shifters are often required to implement both left shifting and right shifting operations. In a typical prior architecture, one set of stages is used to perform a right shift operation and another stage is used to perform a left shift operation to generate a respective one of the two output, and one of the two outputs is selected based on a sign of the shift value. The selection may be performed using another multiplexor stage.
One problem with such an architecture is that the number of stages used may cause unacceptably long time delays in performing shift operations. The long time delays are particularly unacceptable in real-time application environments in which operations may need to be performed quickly.
In addition, the implementations may require a large number of transistors (and thus the area occupied) due to the separate set of stages used. As the number of transistors would approximately equal a multiple of the number of bits in the operands, the total number of transistors may be unacceptably high for operands containing a large number of bits.
Therefore, what is needed is a log shifter which uses a minimum number of stages to shift operands in both left and right directions while potentially minimizing the number of transistors required.